<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        //数组的循环和遍历,用下标去 遍历
        // var array = ['a',1,2,3,4,5,'ab']; 
        // for(var i=0; i<array.length; i++){
        //     console.log(array[i])
        // }
        var array1 = [1,2,3,4,5]; 
        // for(var i=0;i<array1.length; i++){
        //     array1[i] = array1[i] * 2
        // }
        // console.log(array1)

        //for in
        var array2 = ['a','b','c','d'];
        // for(i in array2){
        //     console.log(array2[i])
        // }
        //for - of
        // for(var v of array2){
        //     console.log(v)
        // }

        var obj = {
            name:"周杰伦",
            age:40,
            gender:"男"
        }
        
        for(var key in obj){
            // console.log(obj[key])
            console.log(key + ":" + obj[key])
        }
        


    </script>
</body>
</html>